import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../layout/index'

Vue.use(Router)

export const constantRouterMap = [
  { path: '/login',
    meta: { title: '登录', noCache: true },
    component: (resolve) => require(['@/views/login'], resolve),
    hidden: true
  },
  {
    path: '/404',
    component: (resolve) => require(['@/views/features/404'], resolve),
    hidden: true
  },
  {
    path: '/401',
    component: (resolve) => require(['@/views/features/401'], resolve),
    hidden: true
  },
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path*',
        component: (resolve) => require(['@/views/features/redirect'], resolve)
      }
    ]
  },
  {
    path: '/',
    component: Layout,
    redirect: '/sys',
    hidden: true,
    children: [
      {
        path: 'dashboard',
        component: (resolve) => require(['@/views/home'], resolve),
        name: 'Dashboard',
        meta: { title: '首页', icon: 'index', affix: true, noCache: true }
      }
    ]
  },
  {
    path: '/user',
    component: Layout,
    hidden: true,
    redirect: 'noredirect',
    children: [
      {
        path: 'center',
        component: (resolve) => require(['@/views/system/user/center'], resolve),
        name: '个人中心',
        meta: { title: '个人中心' }
      }
    ]
  },
  {
    path: '/sys',
    component: Layout,
    redirect: '/sys/admin',
    alwaysShow: true, // will always show the root menu
    name: 'webMgr',
    meta: { title: '系统管理', icon: 'menu', affix: true },
    children: [
      // {
      //   path: 'user',
      //   name: 'userList',
      //   component: () => import('@/views/pages/user/list'),
      //   meta: { title: '用户列表', icon: 'user' }
      // }, {
      //   path: 'user/detail',
      //   name: 'userDetail',
      //   hidden: true,
      //   component: () => import('@/views/pages/user/detail'),
      //   meta: { title: '用户详情', icon: 'user',activeMenu:'/sys/user' }
      // },
      {
        path: 'admin',
        name: 'admin',
        component: () => import('@/views/pages/admin/index'),
        meta: { title: '账号管理', icon: 'log' }
      },
      {
        path: 'admin/add',
        name: 'adminAdd',
        hidden: true,
        component: () => import('@/views/pages/admin/add'),
        meta: { title: '创建', icon: 'log',activeMenu:'/sys/admin'  }
      },
      {
        path: 'major',
        name: 'major',
        component: () => import('@/views/pages/major/list'),
        meta: { title: '专业管理', icon: 'log' }
      },
    ]
  },
  
  // {
  //   path: '/school',
  //   component: Layout,
  //   redirect: '/mini/school',
  //   alwaysShow: true, // will always show the root menu
  //   name: 'mini',
  //   meta: { title: '学校管理', icon: 'menu', affix: true },
  //   children: [

  //   ]
  // },
  {
    path: '/mini',
    component: Layout,
    redirect: '/mini/school',
    alwaysShow: true, // will always show the root menu
    name: 'mini',
    meta: { title: '小程序管理', icon: 'menu', affix: true },
    children: [
      {
        path: 'school',
        name: 'school',
        component: () => import('@/views/pages/school/index'),
        meta: { title: '大学管理', icon: 'log' }
      },
      {
        path: 'exam',
        name: 'exam',
        component: () => import('@/views/pages/school/exam'),
        meta: { title: '校考院校', icon: 'log' }
      },
      {
        path: 'stop',
        name: 'stop',
        component: () => import('@/views/pages/school/stop'),
        meta: { title: '停招院校', icon: 'log' }
      },
      {
        path: 'school/add',
        name: 'schoolAdd',
        hidden: true,
        component: () => import('@/views/pages/school/add'),
        meta: { title: '大学新增', icon: 'log',activeMenu:'/mini/school'  }
      },
      {
        path: 'plan',
        name: 'plan',
        component: () => import('@/views/pages/plan/index'),
        meta: { title: '招收计划', icon: 'log' }
      },
      {
        path: 'course',
        name: 'course',
        component: () => import('@/views/pages/classroom/list'),
        meta: { title: '艺考课堂', icon: 'log' }
      },
      {
        path: 'controlLine',
        name: 'controlLine',
        component: () => import('@/views/pages/controlLine/list'),
        meta: { title: '省控线', icon: 'log' }
      },
      {
        path: 'news',
        name: 'news',
        component: () => import('@/views/pages/news/list'),
        meta: { title: '艺考资讯', icon: 'log' }
      },
      {
        path: 'notice',
        name: 'notice',
        component: () => import('@/views/pages/notice/list'),
        meta: { title: '重要公告', icon: 'log' }
      },
      {
        path: 'article',
        name: 'article',
        component: () => import('@/views/pages/article/list'),
        meta: { title: '文章管理', icon: 'log' }
      },
      {
        path: 'college',
        name: 'college',
        component: () => import('@/views/pages/college/index'),
        meta: { title: '院校管理', icon: 'log' }
      },
      {
        path: 'admission',
        name: 'admission',
        component: () => import('@/views/pages/admission/index'),
        meta: { title: '录取数据', icon: 'log' }
      },
      
      {
        path: 'major-school',
        name: 'major-school',
        component: () => import('@/views/pages/major-school/index'),
        meta: { title: '专业管理', icon: 'log' }
      },
      {
        path: 'problem',
        name: 'problem',
        component: () => import('@/views/pages/problem/index'),
        meta: { title: '意见反馈', icon: 'log' }
      },
      {
        path: 'invitationCode',
        name: 'invitationCode',
        component: () => import('@/views/pages/invitationCode/list'),
        meta: { title: '激活码管理', icon: 'log' }
      },
      
    ],
  }
]

export default new Router({
  mode: 'hash',
  // mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
